package wedaex.remote.handler;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONSerializer;
import wedaex.content.ContentExtractor;
import wedaex.content.ContentExtractorSet;
import wedaex.helper.SessionUtils;
import wedaex.remote.JsonHandler;

public class GetContentExtractorListHandler extends JsonHandler {

	@Override
	public String handle(HttpServletRequest request, HttpServletResponse response) throws Exception {
		ContentExtractorSet set = SessionUtils.getContentExtractorSet(request);
		List<String> listName = new ArrayList<String>();
		for (ContentExtractor extractor : set.getExtractors()) {
			listName.add(extractor.getName());
		}
		return JSONSerializer.toJSON(listName).toString();
	}
}
